<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Inform 6 Syntax Errors</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Inform 6 Syntax Errors' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">building</a></li><li><a href="index.html#2">Chapter 2: Blueprints</a></li><li><b>Inform 6 Syntax Errors</b></li></ul></div>
<p class="purpose">To issue problem messages when parsing malformed I6-syntax code.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>Errors like these used to be basically failed assertions, but inevitably people
reported that as a bug (Mantis 0001596). It was never intended that Inform 6-syntax
hacking should be part of the outside-facing Inform language; but if you leave
power tools just lying around, people will eventually pick them up and wonder
what the red button marked "danger" does.
</p>

<p class="commentary">Note that <span class="extract"><span class="extract-syntax">i6_syntax_error_location</span></span> is initially uninitialised and thus has
undefined contents, so we take care to blank it out if it is read before being
written to for the first time.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_provenance</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_syntax_error_location</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_syntax_error_location_set</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="identifier-syntax">text_provenance</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::get_current_location</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">I6Errors::get_current_location</span></span>:<br/><a href="2-i6se.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i6_syntax_error_location_set</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::clear_current_location</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_syntax_error_location</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::clear_current_location</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">I6Errors::clear_current_location</span></span>:<br/><a href="2-i6se.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::set_current_location</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Provenance::nowhere</span><span class="plain-syntax">());</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::set_current_location</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_provenance</span><span class="plain-syntax"> </span><span class="identifier-syntax">where</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_syntax_error_location_set</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_syntax_error_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">where</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::set_current_location_near_splat</span><span class="plain-syntax">(</span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::clear_current_location</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">P</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Inode::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">SPLAT_IST</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::set_current_location</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">SplatInstruction::provenance</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">));</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>The issuing mechanism, or rather, the mechanism used if the main Inform
compiler doesn't gazump us (in order to provide something better-looking in
the GUI apps).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_syntax_error_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::issue</span><span class="plain-syntax">(</span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">message</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">quote</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_provenance</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::get_current_location</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">SourceProblems::I6_level_error</span><span class="plain-syntax">(</span><span class="identifier-syntax">message</span><span class="plain-syntax">, </span><span class="identifier-syntax">quote</span><span class="plain-syntax">, </span><span class="identifier-syntax">at</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Provenance::is_somewhere</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Provenance::get_filename</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">, </span><span class="identifier-syntax">message</span><span class="plain-syntax">, </span><span class="identifier-syntax">quote</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Errors::at_position_S</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">Provenance::get_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Errors::with_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">message</span><span class="plain-syntax">, </span><span class="identifier-syntax">quote</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_syntax_error_count</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::reset_count</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-i6se.html#SP1" class="function-link"><span class="function-syntax">I6Errors::clear_current_location</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_syntax_error_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::errors_occurred</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i6_syntax_error_count</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The functions below are for errors detected when parsing text into schemas, or
when emitting code from them.
</p>

<p class="commentary">Note that the <span class="extract"><span class="extract-syntax">parsing_errors</span></span> field  of a schema is null until the first error
is detected &mdash; which, of course, it usually isn't. It holds a linked list of these:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">message</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_provenance</span><span class="plain-syntax"> </span><span class="identifier-syntax">provenance</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure schema_parsing_error is accessed in 2/is and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::issue_at_node</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">I6Errors::issue_at_node</span></span>:<br/>Tokenisation - <a href="2-tkn.html#SP1_6">&#167;1.6</a><br/>Ramification - <a href="2-rmf.html#SP13_1_1">&#167;13.1.1</a>, <a href="2-rmf.html#SP13_1_2">&#167;13.1.2</a>, <a href="2-rmf.html#SP13_1_5">&#167;13.1.5</a>, <a href="2-rmf.html#SP14">&#167;14</a>, <a href="2-rmf.html#SP14_1">&#167;14.1</a>, <a href="2-rmf.html#SP15">&#167;15</a>, <a href="2-rmf.html#SP22_4">&#167;22.4</a>, <a href="2-rmf.html#SP27">&#167;27</a><br/>Emitting Inter Schemas - <a href="2-eis.html#SP2_1_1">&#167;2.1.1</a>, <a href="2-eis.html#SP2_1_2">&#167;2.1.2</a>, <a href="2-eis.html#SP3_1_1">&#167;3.1.1</a>, <a href="2-eis.html#SP3_1_2_1">&#167;3.1.2.1</a>, <a href="2-eis.html#SP3_1_3">&#167;3.1.3</a>, <a href="2-eis.html#SP3_1_4">&#167;3.1.4</a>, <a href="2-eis.html#SP3_1_5">&#167;3.1.5</a>, <a href="2-eis.html#SP3_1_6">&#167;3.1.6</a>, <a href="2-eis.html#SP3_1_7_2">&#167;3.1.7.2</a>, <a href="2-eis.html#SP3_1_8">&#167;3.1.8</a>, <a href="2-eis.html#SP3_1_11">&#167;3.1.11</a>, <a href="2-eis.html#SP3_1_11_1">&#167;3.1.11.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_schema_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">at</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">message</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parsing_errors</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parsing_errors</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax"> *</span><span class="identifier-syntax">err</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">message</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">message</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">at</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Provenance::is_somewhere</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">)) </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax"> = </span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">) </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax"> = </span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Provenance::nowhere</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Provenance::nowhere</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">err</span><span class="plain-syntax">, </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">, </span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parsing_errors</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Schema error: %S\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">message</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Provenance::is_somewhere</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Schema provenance %f, line %d\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Provenance::get_filename</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Provenance::get_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">provenance</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"$1\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_schema</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>That function of course caches schema errors for playback later: well, here's
the later. Unless the main Inform compiler takes over from us, the result will
be drastic, halting what is presumably the <span class="extract"><span class="extract-syntax">inter</span></span> tool:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">I6Errors::internal_error_on_schema_errors</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">I6Errors::internal_error_on_schema_errors</span></span>:<br/>Parsing Inter Schemas - <a href="2-pis.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_schema</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sch</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">sch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parsing_errors</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SourceProblems::inter_schema_errors</span><span class="plain-syntax">(</span><span class="identifier-syntax">sch</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDERR</span><span class="plain-syntax">, </span><span class="string-syntax">"Parsing error(s) in the internal schema '%S':\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">sch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">converted_from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax"> *</span><span class="identifier-syntax">err</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">err</span><span class="plain-syntax">, </span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">, </span><span class="identifier-syntax">sch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parsing_errors</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDERR</span><span class="plain-syntax">, </span><span class="string-syntax">"- %S\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">err</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">message</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">exit</span><span class="plain-syntax">(1);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-i6a.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-is.html">is</a></li><li class="progresssection"><a href="2-pis.html">pis</a></li><li class="progresssection"><a href="2-tkn.html">tkn</a></li><li class="progresssection"><a href="2-rmf.html">rmf</a></li><li class="progresssection"><a href="2-i6o.html">i6o</a></li><li class="progresssection"><a href="2-eis.html">eis</a></li><li class="progresssection"><a href="2-if.html">if</a></li><li class="progresssection"><a href="2-i6a.html">i6a</a></li><li class="progresscurrent">i6se</li><li class="progresschapter"><a href="3-prd.html">3</a></li><li class="progressnext"><a href="3-prd.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

